<include file="Public:head" title='网址详情' />
<script src="__PUBLIC__/js/other/validate.js"></script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('Modals/lists')}">网址管理</a></li>
                    <li class="active">网址列表</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">网址{$Think.get.id|getPageType}</h3>
                                <form action="{:U('Sites/detail_post2')}" method="POST" id="form"  enctype="multipart/form-data" >
                                    <ul id="jsons" class="jsons">
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                        <li class='li_jsons'>
                                            链接：<input name='source[]' type='text' class='common_txt urls'  value='' autocomplete="off" />
                                            标题：<input name='titles[]' type='text' class='common_txt titles'  value='' autocomplete="off" />
                                            关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' autocomplete="off" />
                                            描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value='' autocomplete="off" />
                                            <a onclick=$(this).parent().remove()>删除</a>
                                        </li>
                                       
                                    </ul>
                                    <table class="table table_detail">
                                        <tbody>
                                            <tr>
                                                <td class="td_left">网址来源:</td>
                                                <td>

                                                    <a onclick="addSite()">+添加多个</a>
                                                </td>
                                            </tr>


                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <button class="btn btn-info btn-sm" type="submit">
                                                        <i class="icon-ok bigger-110 "></i>
                                                        保 存
                                                    </button>
<button class="btn btn-sm btn-danger" type="button" onclick="getSeo()">
                                                    <i class="icon-beaker align-top bigger-125"></i>
                                                    SEO
                                                </button>
                                                    <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                                        <i class="icon-undo bigger-110"></i>
                                                        返 回
                                                    </button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>

                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>

<script type="text/javascript">
    function addSite(ul) {
        var li = "<li class='li_jsons'>链接：<input name='source[]' type='text' class='common_txt urls'  value='' />\n\
        标题：<input name='titles[]' type='text' class='common_txt titles'  value='' />\n\
        关键字：<input name='keywords[]' type='text' class='common_txt keywords'  value='' />\n\
        描述：<input name='descpritions[]' type='text' class='common_txt descpritions'  value=''/>\n\
<a onclick=$(this).parent().remove()>删除</a></li>";
        $('#jsons').append(li);
    }
    function getSeo() {
        var li_first = $("#jsons").children("li.li_jsons:first")
        var url = li_first.children(".urls").val();
        if (li_first.length > 0) {
            getUrlInfo(url);
        } else {
            
        }
    }
    function getUrlInfo(source) { 
        $.post("{:U('Sites/getUrlInfo')}", {
            source: source
        }, function(data) {
            var li_first = $("#jsons").children("li.li_jsons:first");
            li_first.removeClass("li_jsons");
            li_first.find(".titles").val(data.title);
            li_first.find(".keywords").val(data.keywords);
            li_first.find(".descpritions").val(data.descprition);
           getSeo();
        },"json")
    }
</script>
<include file="Public:foot" />